{% extends 'generic/object.html' %}
{% load i18n %}
{% load helpers %}
{% load render_table from django_tables2 %}

{% block title %}{% trans "Group" %} {{ object.name }}{% endblock %}

{% block subtitle %}{% endblock %}

{% block content %}
  <div class="row mb-3">
    <div class="col-md-6">
      <div class="card">
        <h2 class="card-header">{% trans "Group" %}</h2>
        <table class="table table-hover attr-table">
          <tr>
            <th scope="row">{% trans "Name" %}</th>
            <td>{{ object.name }}</td>
          </tr>
          <tr>
            <th scope="row">{% trans "Description" %}</th>
            <td>{{ object.description|placeholder }}</td>
          </tr>
        </table>
      </div>
    </div>
    <div class="col-md-6">
      <div class="card">
        <h2 class="card-header">{% trans "Users" %}</h2>
        <div class="list-group list-group-flush">
          {% for user in object.users.all %}
            <a href="{% url 'users:user' pk=user.pk %}" class="list-group-item list-group-item-action">{{ user }}</a>
          {% empty %}
            <div class="list-group-item text-muted">{% trans "None" %}</div>
          {% endfor %}
        </div>
      </div>
      <div class="card">
        <h2 class="card-header">{% trans "Assigned Permissions" %}</h2>
        <div class="list-group list-group-flush">
          {% for perm in object.object_permissions.all %}
            <a href="{% url 'users:objectpermission' pk=perm.pk %}" class="list-group-item list-group-item-action">{{ perm }}</a>
          {% empty %}
            <div class="list-group-item text-muted">{% trans "None" %}</div>
          {% endfor %}
        </div>
      </div>
    </div>
  </div>
{% endblock %}
